/*
 ============================================================================
 Name		: DocDetailData.cpp
 Author	  : JohnLZeng
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CDocDetailData implementation
 ============================================================================
 */

#include "DocDetailData.h"
#include "MacroUtil.h"

CDocDetailData::CDocDetailData()
:iTitle(NULL),iContent(NULL)
	{
	// No implementation required
	}

CDocDetailData::~CDocDetailData()
	{
	SAFE_DELETE(iTitle)
	SAFE_DELETE(iContent)
	}

CDocDetailData* CDocDetailData::NewLC()
	{
	CDocDetailData* self = new (ELeave) CDocDetailData();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

CDocDetailData* CDocDetailData::NewL()
	{
	CDocDetailData* self = CDocDetailData::NewLC();
	CleanupStack::Pop(); // self;
	return self;
	}

void CDocDetailData::ConstructL()
	{

	}


void CDocDetailData::SetTitle(const TDesC& aTitle)
	{
	SAFE_DELETE(iTitle)
	
	iTitle = aTitle.AllocL();
	}

void CDocDetailData::AppendTitle(const TDesC& aTitle)
	{
	if (iTitle)
		{
		iTitle = iTitle->ReAllocL(iTitle->Length() + aTitle.Length());
		iTitle->Des().Append(aTitle);
		}
	else
		iTitle = aTitle.AllocL();
	}

void CDocDetailData::AppendContent(const TDesC& aContent)
	{
	if (iContent)
		{
		iContent = iContent->ReAllocL(iContent->Length() + aContent.Length());
		iContent->Des().Append(aContent);
		}
	else
		iContent = aContent.AllocL();
	}
